<?php

/********************************************************************
GLOBAL CALL
********************************************************************/

$cpanel['name'] = 'mytheme';
$cpanel['lib'] = TEMPLATEPATH.'/cpanel/lib.php';
$cpanel['cpanel'] = TEMPLATEPATH.'/cpanel/cpanel.php';
$cpanel['modules_dir'] = TEMPLATEPATH.'/cpanel/modules/';
$cpanel['img_dir'] = get_template_directory_uri().'/cpanel/img/';
$cpanel['js_dir'] = get_template_directory_uri().'/cpanel/js/';
$cpanel['css_dir'] = get_template_directory_uri().'/cpanel/css/';
require_once $cpanel['lib'];
require_once $cpanel['cpanel'];

/********************************************************************
*********************************************************************
********************************************************************/

/********************************************************************
register sidebar widgets
********************************************************************/
if (function_exists('register_sidebar'))

register_sidebar(array(
'name'=>'Main Sidebar',
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '<span class="foot"></span></li>',
'before_title' => '<h2>',
'after_title' => '<a href="#minimize" class="Wminimize"></a></h2>'
));

register_sidebar(array(
'name'=>'Left Sidebar',
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '<span class="foot_s"></span></li>',
'before_title' => '<h2>',
'after_title' => '</h2>'
));

register_sidebar(array(
'name'=>'Right Sidebar',
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '<span class="foot_s"></span></li>',
'before_title' => '<h2>',
'after_title' => '</h2>'
));

register_sidebar(array(
'name'=>'Search Sidebar',
'before_widget' => '<div id="ricerca-avv" class="box_a">',
'after_widget' => '<span class="foot"></span></div>',
'before_title' => '<h2>',
'after_title' => '<a class="Sminimize" href="#minimize"></a><a class="Sclose" href="#close"></a></h2>'
));

/********************************************************************
custom comment display
********************************************************************/
function mytheme_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">

	<div id="comment-<?php comment_ID(); ?>">

		<div class="comment-author vcard">
		<?php echo get_avatar($comment,$size='52',$default=''); ?>
		<cite class="fn"><?php print get_comment_author_link(); ?></cite>
		</div>

		<div class="comment-meta commentmetadata">
		<a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">Posted on <?php print get_comment_date(); ?> at <?php print get_comment_time(); ?></a><?php edit_comment_link(__('(Edit)'),'  ','') ?>
		</div>

		<?php comment_text() ?>

		<div class="reply">
		<?php comment_reply_link(array_merge( $args, array('add_below' => 'comment', 'depth' => $depth, 'max_depth' => $args['max_depth']))); ?>
		</div>

	</div><div class="clear"></div>
<?php
}

/**
 * Funzioni custom by WeBeing 2009.06
 */

function mySearchFilter($query) {
	if ($query->is_search) {
		$query->set('post_type','post');
		$query->set('meta_key','Premium');
		$query->set('category_name','Professionisti');
		$query->set('orderby', 'meta_value');
		$query->set('order', 'DESC');
		
	}
	return $query;
}

add_filter('pre_get_posts','mySearchFilter');


?>